home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / MorphOS / Epic4_mos / share / epic / script / tc < prev    next >
Encoding:
Text File  |  2002-10-28  |  2.5 KB  |  79 lines

  1. /*
  2.  * ``TC'' - Tabscript Clone For EPIC
  3.  * Copyright 1995 Jeremy Nelson
  4.  * Copyright 1998 The EPIC Project
  5.  * Originally written for Daveman's Toolbox
  6.  * Please use and distribute this script like crazy!
  7.  */
  8.  
  9. #
  10. # (note from jfn)  The original allowed you to save up to 10 nicks to 
  11. # by cycled through by pressing <tab> or <esc>.  I totaly rewrote the file
  12. # and added the ability to set the number of nicks to save, and also made 
  13. # it a full tabkey clone.  This file is a lot easier to figure out, too.
  14. # What it does:
  15. #     save an arbitrary number of nicks in a list (settable by you)
  16. #     cycle through the list by pressing <tab>
  17. #     cycle backwards through the list by pressing <^R>
  18. #     remove last <TAB>bed nick from the list (^X^X)
  19. #
  20. # Because this script uses a queue instead of a list and index counter, 
  21. # you may find this script has a different set of idiosyncrasies then 
  22. # the original tabscript.
  23. #
  24. package tc
  25. bind ^I parse_command ^tc.get_nick
  26. bind ^R parse_command ^tc.get_nick_backward
  27. bind ^X^X parse_command {
  28.     xecho -b Nickname $word($tc.position $tc.msglist) removed
  29.     @ tc.msglist = notw($tc.position $tc.msglist)
  30.     @ tc.num_nicks = #tc.msglist
  31.     @ tc.position--
  32.     tc.get_nick
  33. }
  34.  
  35. # maximum number of nicks you want to keep track of...
  36. @ tc.max_nicks = 6
  37.  
  38. #
  39. # add a word to a list -- makes sure the list doesnt get longer then
  40. # the number allowed in max_nicks.
  41. #
  42. alias tc.add_to_list {
  43.     # This was suggested by David Luyer (david_luyver@pacfici.net.au)
  44.     (tc.msglist = [$0 $leftw(${tc.max_nicks-1} $remw($0 $tc.msglist))])
  45.     (tc.num_nicks = #tc.msglist)
  46.     (tc.position = 0)
  47. }
  48. alias tc.get_nick {
  49.     parsekey erase_line
  50.     xtype -l /msg $word($tc.position $tc.msglist) 
  51.     ((++tc.position >= tc.num_nicks) && (tc.position -= tc.num_nicks))
  52. }
  53. alias tc.get_nick_backward {
  54.     parsekey erase_line
  55.     xtype -l /msg $word($tc.position $tc.msglist) 
  56.     ((--tc.position < 0) && (tc.position += tc.num_nicks))
  57. }
  58.  
  59. alias addnick for x in ($*) {tc.add_to_list $x}
  60. alias nicklist xecho -b Nickname list: $tc.msglist
  61.  
  62. on #-msg -12782 * tc.add_to_list $0
  63. on #-send_msg -12782 * tc.add_to_list $0 
  64.  
  65. on #-dcc_chat -12782 * tc.add_to_list =$0
  66. on #-send_dcc_chat -12782 * tc.add_to_list =$0
  67.  
  68. /*
  69.  * This alias doesnt work if you try to do something like:
  70.  * /m x ....
  71.  * because $x expands to your userhost, and that gets confusing.
  72.  *
  73.  * No, the lack of brackets around $0 is not a bug, thats how it works.
  74.  * Try it.  If $0 is 'bc' and $bc is "bigcheese" then 
  75.  * if ($0) -> if (bc) -> if ([bigcheese])
  76.  */
  77. ALIAS M if \($0\) {msg $($0) $1-} {msg $0 $1-}
  78.